<template>
	<div id="app">
		<div id="note_comment_list">
			<div class="tag">
				<a class="cur">最新评论</a>
			</div>

			<ul>
				<li v-for="a in comment1">

					<div class="pic"><img :src="'https://yo.docshare.org.cn'+a.user_photo"></div>
					<div class="con">
						<label>{{a.user_name}}</label>
						<p>{{a.comment}}</p>
						<span>发表于：{{a.commentdate}}</span>
						<div class="clear"></div>
					</div>
				</li>
			</ul>
			<div class="button_mo">
				<a @click="itemClicked(comment)">写评论</a>
			</div>

		</div>
	</div>
</template>

<script>
	import config from '@/config'
	export default {
		data() {
			return {
				usr: '',
				comment1: [],
				comment: {},
				vid: '',
			}
		},
		methods: {
			itemClicked: function(item) {
				uni.navigateTo({
					url:`note_post_comment?id=${item.id}`,
				})
			},
			itemClicked1: function(item) {
				uni.navigateTo({
					url:`add_detail?id=${item.id}`,
				})
			}
		},
		onLoad(option) {
			var that = this;
			if (option.id) {
				this.vid = option.id;
			}
			uni.request({
				url: `${config.baseUrl}/article/listcomment?id=${that.vid}&token=${uni.getStorageSync('token')}`,
				method: "GET",
				success(r) {
					if (r.data.succ) {
						that.comment1 = r.data.data;
					} else {

					}
				},
					complete(res){
						if(res.data && res.data.msg){
							uni.showToast({
								icon:'none',
								title:res.data.msg
							})
						}
					},
			})
			uni.request({
				url: `${config.baseUrl}/article/one?id=${that.vid}&token=${uni.getStorageSync('token')}`,
				method: "GET",
				success(r) {
					if (r.data.succ) {
						that.comment = r.data.data;
					} else {

					}
				},
					complete(res){
						if(res.data && res.data.msg){
							uni.showToast({
								icon:'none',
								title:res.data.msg
							})
						}
					},
			})
		}
	}
</script>

<style>
</style>
